import 'package:flutter/material.dart';
import 'package:jd_shopping/pages/Coustom/JdText.dart';
import 'package:jd_shopping/pages/Coustom/JdButton.dart';
import 'package:jd_shopping/services/ScreenAdaper.dart';

class LoginPage extends StatefulWidget {
  @override
  _LoginPageState createState() => _LoginPageState();
}

class _LoginPageState extends State<LoginPage> {
  @override
  Widget build(BuildContext context) {
    ScreenAdaper.init(context);
    return Scaffold(
      appBar: AppBar(
        leading: IconButton(
          icon: Icon(Icons.close),
          onPressed: () {
            Navigator.pop(context);
          },
        ),
        // title: Text("登录页面"),
        actions: <Widget>[
          FlatButton(
            child: Text("客服"),
            onPressed: () {},
          )
        ],
      ),
      body: ListView(
        children: <Widget>[
          Column(
            children: <Widget>[
             Center(
              child: Container(
                margin: EdgeInsets.only(top: 30),
                height: ScreenAdaper.width(160),
                width: ScreenAdaper.width(160),
                // child: Image.asset('images/login.png'),
                child: Image.network(
                    'https://www.itying.com/images/flutter/list5.jpg',
                    fit: BoxFit.cover),
              ),
            ),

              SizedBox(height: ScreenAdaper.height(50)),
              Container(
                margin: EdgeInsets.fromLTRB(10, 0, 10, 0),
                child: Column(
                  children: <Widget>[
                    JdText(
                      text: '用户名/手机号',
                      password: false,
                      onChanged: (value) {},
                    ),
                    SizedBox(height: ScreenAdaper.height(30)),
                    JdText(
                      text: '请输入密码',
                      password: true,
                      onChanged: (value) {},
                    ),
                    SizedBox(height: 10),
                    Container(
                      padding: EdgeInsets.all(ScreenAdaper.width(20)),
                      child: Stack(
                        children: <Widget>[
                          Align(
                            alignment: Alignment.centerLeft,
                            child: Text('忘记密码'),
                          ),
                          Align(
                            alignment: Alignment.centerRight,
                            child: InkWell(
                              onTap: () {
                                Navigator.pushNamed(context, '/regfirst');
                              },
                              child: Text('新用户注册'),
                            ),
                          )
                        ],
                      ),
                    ),
                    SizedBox(height: 10),
                    JdButton(
                      color: Colors.red,
                      text: '登录',
                      cb: (){
                         print('123');
                      },
                    )
                  ],
                ),
              )
            ],
          )
        ],
      ),
    );
  }
}
